package csc.daonjpa.java.domain;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 * Entity class for Account table. This is a simple POJO class with annotations to define mapping with DB table
 * @author nvu3
 *
 */
@Entity
public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;
	
	// accountNumber field maps with accountNumber column in Account table
	// @Id indicates that accountNumber is the primary key for Account table
	@Id
	@Column(name = "loginId")
	private Long loginId;
	
	@Column(name = "password")
	private String password;
	
	@Column(name = "firstName")
	private String firstName;

	@Column(name = "lastName")
	private String lastName;
	
	@Column(name = "address")
	private String address;
	
	@Column(name = "phone")
	private String phone;
	
	@OneToMany(mappedBy="customer")
	private Collection<Account> accounts;
	
	@OneToMany(mappedBy="customer")
	private Collection<Card> cards;
	
	/**
	 * Required constructor
	 */
	public Customer() {
	
	}
	
	@Override
	public String toString() {
		return "Customer [loginId=" + loginId + ", password=" + password
				+ ", firstName=" + firstName + ", lastName=" + lastName
				+ ", address=" + address + ", phone=" + phone + "]";
	}

	public Long getLoginId() {
		return loginId;
	}
	public void setLoginId(Long loginId) {
		this.loginId = loginId;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	
}